<template>
<!-- 沟通提醒 -->
  <div>
    <el-card class="box-card">
      <div slot="header" class="clearfix">
        <span style="line-height: 36px;">3天未沟通客户</span>
      </div>
      <custom-list :type="'待沟通'" ref="customList" @goAddCommunication="goAddCommunication" @goCustomEditer="goCustomEditer" ></custom-list>
    </el-card>
    <div class="space20">
    </div>
    <el-card class="box-card">
      <div slot="header" class="clearfix">
        <span style="line-height: 36px;">7天未沟通渠道</span>
      </div>
      <organization-list :type="'待沟通'" ref="organizationList" @goAddCommunication="goAddCommunication" @goAddCustom="goAddCustom"  @goOrganizaitionEditer="goOrganizaitionEditer"></organization-list>
    </el-card>
    <div class="space20">
    </div>
    <el-card class="box-card">
      <div slot="header" class="clearfix">
        <span style="line-height: 36px;">需续保客户</span>
      </div>
      <custom-list :type="'待续保'" @goCustomEditer="goCustomEditer" @goAddCommunication="goAddCommunication"></custom-list>
    </el-card>
    <el-dialog title="沟通记录添加" :visible.sync="connectionAdd" v-if="connectionAdd">
      <communication-Add :id="id" :type="type" @close="close">
      </communication-Add>
    </el-dialog>
    <el-dialog title="新增客戶" :visible.sync="customAdd" v-if="customAdd">
      <custom-show :type="'渠道新增'" :OrganizationId="oid"  @close="close">
      </custom-show>
    </el-dialog>
    <el-dialog title="查看客戶信息" :visible.sync="customEditer" v-if="customEditer" size="large">
      <custom-show :oid="oid" :type="'修改'" :Id="Cid" @close="close">
      </custom-show>
    </el-dialog>
     <el-dialog title="查看渠道" :visible.sync="organizaitionEditer" v-if="organizaitionEditer" size="large">
      <organization-show  :type="'修改'" :Id="oid" @goCustomEditerA="goCustomEditerA" @goAddCommunicationA="goAddCommunicationA"  @close="close">
      </organization-show>
    </el-dialog>
    
  </div>
</template>
<script>
import CustomList from '@/components/Crm/CustomList'
import OrganizationList from '@/components/Crm/OrganizationList'
import CommunicationAdd from '@/components/Crm/CommunicationAdd'
import CustomShow from '@/components/Crm/CustomShow'
import OrganizationShow from '@/components/Crm/OrganizationShow'
export default {
  data() {
    return {
      connectionAdd: false,//渠道新增
      id: '',//沟通记录 客户、渠道id 
      type: '',//沟通记录 类型

      customAdd: false,
      oid: '',// 渠道id
      customEditer: false,
      organizaitionEditer: false,
      //客户id
      Cid:'',

    }
  },
  components: {
    'custom-list': CustomList,
    'organization-list': OrganizationList,
    'communication-Add': CommunicationAdd,
    'custom-show': CustomShow,
    'organization-show':OrganizationShow
  },
  methods: {
    goAddCommunication(data) {
      this.id = data.id;
      this.type = data.type;
      this.connectionAdd = true;
    },
    goAddCustom(oid) {
     
      this.oid = oid;
      this.customAdd = true;
    },
    //查看修改 客戶信息
    goCustomEditer(id) {
      this.customEditer = true;
      this.Cid=id;
    },
    goCustomEditerA(id){   
      this.organizaitionEditer=false;
       this.customEditer = true;
    },
    //修改渠道信息
    goOrganizaitionEditer(id) {
      this.organizaitionEditer = true;
      this.oid=id;
    },
    goAddCommunicationA(data){
      this.organizaitionEditer = false;
       this.id = data.id;
      this.type = data.type;
      this.connectionAdd = true;
    },
     //关闭弹窗
        close() {
            this.connectionAdd = false;
             this.customAdd = false;            
            this.customEditer = false;
            this.organizaitionEditer=false;         
            //更新list
            this.$refs.organizationList.Getdata();   
            this.$refs.customList.Getdata();   
        }
  }

}
</script>

